Skip to content

Conversation

Harshdhall01
Copy link

Problem

When using MuJoCo MJX with Warp backend and JAX compilation, the second call to a compiled function fails with:
AttributeError: undefined symbol: wp_cuda_graph_launch. Did you mean: 'cuda_graph_launch'?

Root Cause

The Warp library exports the symbol as cuda_graph_launch but the MJX FFI code looks for wp_cuda_graph_launch (with wp_ prefix).

Solution

File: mjx/mujoco/mjx/third_party/warp/jax_experimental/ffi.py (line ~578)

Changed wp.context.runtime.core.wp_cuda_graph_launch to wp.context.runtime.core.cuda_graph_launch

Testing

  • ✅ Tested on WSL2 Ubuntu with NVIDIA GTX 1650, CUDA 12.6
  • ✅ MuJoCo 3.3.6, JAX 0.7.2, Warp 1.8.1
  • ✅ Both first and second calls to compiled functions now succeed
  • ✅ No more symbol errors

Fixes #2865

Copy link

google-cla bot commented Sep 21, 2025

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

The Warp library exports cuda_graph_launch but MJX FFI code
was looking for wp_cuda_graph_launch (with wp_ prefix).
This caused AttributeError on second call to JAX-compiled functions.

Fixes: undefined symbol error in Warp backend with JAX compilation
@Harshdhall01 Harshdhall01 force-pushed the fix-warp-cuda-graph-symbol branch from db66919 to bb76189 Compare September 23, 2025 12:40
@Tadinu
Copy link

Tadinu commented Oct 6, 2025

@Harshdhall01 In Warp, it was originally added here and looks still so currently, so should the PR go there also?

@Harshdhall01
Copy link
Author

@Tadinu Thanks for reviewing!

You're right that the symbol naming originates in Warp. However, I found that:

  • The Warp library exports the symbol as cuda_graph_launch (without wp_ prefix)
  • MuJoCo's MJX code expects wp_cuda_graph_launch (with prefix)

I checked the Warp source and the symbol is indeed exported as cuda_graph_launch. Should I:

  1. Submit this fix to MuJoCo to match what Warp exports, OR
  2. Submit a PR to Warp to add the wp_ prefix?

Which approach would the maintainers prefer?

@btaba
Copy link
Collaborator

btaba commented Oct 7, 2025

Hello @Harshdhall01 , we vendor the FFI file from warp-lang, so we don't modify it directly. Presumably you are getting a mismatch in the cuda_graph_launch symbol due to a mismatch in your warp-lang version compared to what FFI expects.

It looks like 3.3.6 had a mismatch in the warp-lang version here. I'm not sure how this didn't fail in our CI. If you bump warp-lang>=1.9.0, I think this should resolve your issue.

@btaba
Copy link
Collaborator

btaba commented Oct 7, 2025

Since the warp-lang version at HEAD is working with its corresponding FFI, I'll be closing this PR. Please let us know if you have any other issues here!

uv pip install mujoco --pre --upgrade -f https://py.mujoco.org/
git clone https://github.com/google-deepmind/mujoco.git
cd mujoco/mjx
uv pip install -e .[warp]

then run your example

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

undefined symbol: wp_cuda_graph_launch raised when using the Warp MJX backend
3 participants